// ============================================================================
//
// Copyright (C) 2006-2007 Dengues
//
// Google Group: http://groups.google.com/group/dengues
//
// QQ Group: 24885404
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ============================================================================
package org.dengues.ui.prefs.connectivity;

import org.dengues.commons.connectivity.IConnectivitySettingsConstants;
import org.dengues.core.i18n.Messages;

/**
 * Qiang.Zhang.Adolf@gmail.com class global comment. Detailled comment <br/>
 * 
 * $Id: Dengues.epf 1 2006-09-29 17:06:40Z qiang.zhang $
 * 
 */
public enum EConnectivityProperties {
    PROP_ID_JARLIST("JARLIST", Messages.getString("ConnectivityDialog.jarlist")), //$NON-NLS-1$//$NON-NLS-2$
    PROP_ID_URL("URL", Messages.getString("ConnectivityPropertySource.url")), //$NON-NLS-1$//$NON-NLS-2$
    PROP_ID_PASSWORD("PASSWORD", Messages.getString("ConnectivityPropertySource.password")), //$NON-NLS-1$//$NON-NLS-2$
    PROP_ID_DRIVER("DRIVER", Messages.getString("ConnectivityPropertySource.driver")), //$NON-NLS-1$//$NON-NLS-2$
    PROP_ID_DATABASE("SID", Messages.getString("ConnectivityPropertySource.database")), //$NON-NLS-1$//$NON-NLS-2$
    PROP_ID_SCHEMA("SCHEMA", Messages.getString("ConnectivityPropertySource.schema")), //$NON-NLS-1$//$NON-NLS-2$
    PROP_ID_PORT("PORT", Messages.getString("ConnectivityPropertySource.port")), //$NON-NLS-1$//$NON-NLS-2$
    PROP_ID_HOST("HOST", Messages.getString("ConnectivityPropertySource.host")), //$NON-NLS-1$//$NON-NLS-2$
    PROP_ID_ROOTPATH("ROOTPATH", Messages.getString("ConnectivityPropertySource.rootpath")), //$NON-NLS-1$//$NON-NLS-2$
    PROP_ID_FILE("FILE", Messages.getString("ConnectivityPropertySource.file")), //$NON-NLS-1$//$NON-NLS-2$
    PROP_ID_USER("USERNAME", Messages.getString("ConnectivityPropertySource.user"));//$NON-NLS-1$//$NON-NLS-2$

    private String paramName;

    private String displayName;

    /**
     * Qiang.Zhang.Adolf@gmail.com EConnectivityProperties constructor comment.
     */
    EConnectivityProperties(String paramName, String displayName) {
        this.paramName = paramName;
        this.displayName = displayName;
    }

    public String getParamName() {
        return this.paramName;
    }

    public String getPropId() {
        return IConnectivitySettingsConstants.PROP_PREFIX + paramName.toLowerCase();
    }

    public String getDisplayName() {
        return this.displayName;
    }

    public static String getDisplayNameFromId(String id) {
        if (id.equals(IConnectivitySettingsConstants.PROP_DEFN_JARLIST)) {
            return PROP_ID_JARLIST.getDisplayName();
        }
        for (EConnectivityProperties properties : values()) {
            if (properties.getPropId().equals(id)) {
                return properties.getDisplayName();
            }
        }
        return null;
    }
}
